<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>安全生命防护工程--${fns:getConfig('productName')}</title>
<%@include file="/common/head.jsp"%>
<link rel="stylesheet" type="text/css"
	href="${ctxStatic}/step/css/onlinebusinesshall/newexpand/css/index-debug.css">
<link rel="stylesheet" type="text/css"
	href="${ctxStatic}/step/css/index.css">
<style>
.intro-list-right button{
	float:left;
	margin-left:30px;
}
.intro-list-content{
	min-height:20px;
	background-color: white;
}
</style>
<script>
   // 计算页面的实际高度，iframe自适应会用到
   function calcPageHeight(doc) {
     var cHeight = Math.max(doc.body.clientHeight, doc.documentElement.clientHeight)
//      var sHeight = Math.max(doc.body.scrollHeight, doc.documentElement.scrollHeight)
//      var height  = Math.max(cHeight, sHeight);
     return cHeight;
   }
   window.onload =  function () {
	   changeHeight();
   }
   
   $(function(){
	   loadCss();
   })
   
   function changeHeight(){
	   var height = calcPageHeight(document);
	     parent.document.getElementById('ifr').style.height = height +'px'
   }
   
   function loadCss(currentStatus,refuseStatus){
	   var currentStatus = $('#currentStatus').val();
	   var refuseStatus = $('#refuseStatus').val();
	   var roleType = $('#roleType').val();
	   var id = $('#id').val();
		$('.intro-list').each(function(){
			if($(this).hasClass('intro-list-active')){
				$(this).removeClass('intro-list-active');
			}
				$(this).find('button').attr('style','display:none');
		});
		
			for(var i = 1; i<=currentStatus;i++){
				$('#div-'+i).removeAttr('style'); //显示当前状态前的文件列表框
				if(i == currentStatus  && currentStatus!='5'){
					$('#div-'+currentStatus).addClass('intro-list-active'); //选中当前状态对应的框
					$('#div-'+currentStatus+' button').attr('style','display:block');
				}
				if(i!='5'){
					$('#div-'+i+' iframe').attr('src',appConfig.contPath+'/attachment/fileList.do?tableId='+id+'&partId='+i);
				}
			}
	}
   
	function uploadAttachmentFiles(tableId,tableName,partId,tableField,labelName){
		top.$.jBox("iframe:"+appConfig.contPath+"/attachment/uploads.do?tableId="+tableId+"&tableName="+tableName+"&partId="+partId+"&tableField="+tableField, 
 			{
 			 title: labelName+"文件上传",
 			 width: 800,
 		     height: 500,
 		     showClose:true,
 		     persistent:true,
 			 buttons:{"关闭":"ok",}, 
 			 closed:function(v, h, f){
 				  $('#'+tableId+'_'+partId).attr('src',$('#'+tableId+'_'+partId).attr('src')+'&file=1');
//  				   changeHeight();
 			}, 
 			loaded:function(h){
 				$(".jbox-content", top.document).css("overflow-y","hidden");
 			}
 		});
 	}
</script>
</head>
<body style="overflow-y:hidden">
<div id='content1'>
	<input type='hidden' name="currentStatus" value="${lifeCherish.currentStatus}" id="currentStatus" />
	<input type='hidden' name="refuseStatus" value="${lifeCherish.refuseStatus}" id="refuseStatus" />
	<input type='hidden' name="roleType" value="${roleType}" id="roleType" />
	<input type='hidden' name="id" value="${lifeCherish.id}" id="id" />
	<div class="step-content">
		<div class="step-list">
			<div class="page-panel-title">
				<h3 class="page-panel-title-left">流程说明</h3>
				<h3 class="page-panel-title-right">注：黄色为需要你配合的环节</h3>
			</div>
			<div class="intro-flow">
				<div class="intro-list" id="div-1" style="display:none">
					<div class="intro-list-left">实施计划</div>
					<div class="intro-list-right">
						<span>1</span>
						<div class="intro-list-content">
<%-- 							<iframe frameborder=0 width=100% width=100%  id="${lifeCherish.id}_1" src="${ctx}/attachment/fileList.do?tableId=${lifeCherish.id}&partId=1"></iframe> --%>
							<iframe frameborder=0 width=100% width=100%  id="${lifeCherish.id}_1" src=""></iframe>
						</div>
						<button class="btn btn-success " type="button" style="margin-left: 40px" id="button_${id}${tableField}" 
						onclick='uploadAttachmentFiles("${lifeCherish.id}","T_AF_LIFEPROJECT","1","id","实施计划")' data-toggle="dropdown">
							实施计划附件<i class='icon-arrow-up'></i>
						</button>
					</div>
				</div>
				<div class="intro-list" id="div-2" style="display:none">
					<div class="intro-list-left">工程设计</div>
					<div class="intro-list-right">
						<span>2</span>
						<div class="intro-list-content">
							<iframe frameborder=0 width=100% width=100%  id="${lifeCherish.id}_2" src=""></iframe>
						</div>
						<button class="btn btn-success " type="button" style="margin-left: 40px" id="button_${id}${tableField}" 
						onclick='uploadAttachmentFiles("${lifeCherish.id}","T_AF_LIFEPROJECT","2","id","工程设计")' data-toggle="dropdown">
							工程设计附件<i class='icon-arrow-up'></i>
						</button>
					</div>
				</div>
				<div class="intro-list" id="div-3" style="display:none">
					<div class="intro-list-left">工程实施</div>
					<div class="intro-list-right">
						<span>3</span>
						<div class="intro-list-content">
							<iframe frameborder=0 width=100% width=100%  id="${lifeCherish.id}_3" src=""></iframe>
						</div>
						<button class="btn btn-success " type="button" style="margin-left: 40px" id="button_${id}${tableField}" 
						onclick='uploadAttachmentFiles("${lifeCherish.id}","T_AF_LIFEPROJECT","3","id","工程实施")' data-toggle="dropdown">
							工程实施附件<i class='icon-arrow-up'></i>
						</button>
					</div>
				</div>
				<div class="intro-list" id="div-4" style="display:none">
					<div class="intro-list-left">工程验收</div>
					<div class="intro-list-right">
						<span>4</span>
						<div class="intro-list-content">
							<iframe frameborder=0 width=100% width=100%  id="${lifeCherish.id}_4" src=""></iframe>
						</div>
						<button class="btn btn-success " type="button" style="margin-left: 40px" id="button_${id}${tableField}" 
						onclick='uploadAttachmentFiles("${lifeCherish.id}","T_AF_LIFEPROJECT","4","id","工程验收")' data-toggle="dropdown">
							工程验收附件<i class='icon-arrow-up'></i>
						</button>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div class="footer-btn">
		<div class="common-btn"></div>
	</div>
	</div>
</body>
</html>